#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 文件名：17-mysql操作类.py
import logging

LOG_FORMAT = "%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s "  # 配置输出日志格式
DATE_FORMAT = '%Y-%m-%d  %H:%M:%S %a '

logging.basicConfig(level=logging.DEBUG,
                    format=LOG_FORMAT,
                    datefmt=DATE_FORMAT,
                    filename='myapp.log',
                    # 注意路径
                    filemode='a'
                    )
                    
logging.debug("msg1")
logging.info("msg2")
logging.warning("msg3")
logging.error("msg4")
logging.critical("msg5")

'''
2019 - 08 - 08  16: 59: 07 Thu  log1.py[line:24] INFO msg2
2019-08-08  16:59:07 Thu  log1.py[line:25] WARNING msg3 
2019-08-08  16:59:07 Thu  log1.py[line:26] ERROR msg4 
2019-08-08  16:59:07 Thu  log1.py[line:27] CRITICAL msg5
'''
